<!DOCTYPE html>
<html>
<head>
    <meta charset="utf-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <title>试卷管理</title>
    <#include "/common/link.ftl">

</head>
<body class="hold-transition skin-black sidebar-mini">
<div class="wrapper">
    <#include "/common/navbar.ftl">
    <#assign currentMenu="exam"/>
    <#include "/common/menu.ftl">
    <div class="content-wrapper">
        <section class="content-header">
            <h1>试卷编辑</h1>
        </section>
        <section class="content">
            <div class="box" style="padding: 10px">
                <form class="form-horizontal" action="/exam/save" method="post" id="editForm" >

                    <input type="hidden"  name="id">
                    <div class="form-group"  style="margin-top: 10px;">
                        <label  class="col-sm-2 control-label">试卷名称：</label>
                        <div class="col-sm-6">
                            <input type="text" class="form-control" name="title"  placeholder="请输入试卷名称">
                        </div>
                    </div>

                    <div class="form-group">
                        <label class="col-sm-2 control-label">考试时长：</label>
                        <div class="col-sm-6">
                            <input type="text" class="form-control"  name="examMinute" placeholder="请输入考试时长">
                        </div>
                    </div>
                    <div class="form-group">
                        <label class="col-sm-2 control-label">单选题：</label>

                        <div class="col-sm-3">
                            <input type="text" class="form-control" name="radio"  placeholder="请输入随机组题数量">
                        </div>

                        <div class="col-sm-3">
                            <input type="text" class="form-control" name="radioScore"  placeholder="请输入每题分数">
                        </div>
                    </div>
                    <div class="form-group">
                        <label class="col-sm-2 control-label">多选题：</label>

                        <div class="col-sm-3">
                            <input type="text" class="form-control" name="checkbox"  placeholder="请输入随机组题数量">
                        </div>

                        <div class="col-sm-3">
                            <input type="text" class="form-control" name="checkboxScore"  placeholder="请输入每题分数">
                        </div>
                    </div>
                    <div class="form-group">
                        <label class="col-sm-2 control-label">判断题：</label>

                        <div class="col-sm-3">
                            <input type="text" class="form-control" name="estimate"  placeholder="请输入随机组题数量">
                        </div>

                        <div class="col-sm-3">
                            <input type="text" class="form-control"  name="estimateScore" placeholder="请输入每题分数">
                        </div>
                    </div>


                    <div class="form-group">
                        <label class="col-sm-2 control-label">试卷总分：</label>
                        <div class="col-sm-6">
                            <input type="text" class="form-control" name="totalScore"  placeholder="请输入试卷总分">
                        </div>
                    </div>

                    <div class="form-group">
                        <div class="col-sm-offset-6 col-sm-6">
                            <button type="button" class="btn btn-primary btn-submi">生成试卷</button>
                            <a href="javascript:window.history.back()" class="btn btn-danger">取消</a>
                        </div>
                    </div>

                </form>
            </div>
        </section>
    </div>
    <#include "/common/footer.ftl">
</div>

<script>
    $('.btn-submi').click(function () {
        var editForm = $('#editForm').serialize();
        $.post("/exam/save",editForm,function (data) {
            if (data){
                Swal.fire({
                    text: "生成成功",
                    type: 'success',
                    showCancelButton: true,
                    confirmButtonColor: '#3085d6',
                    cancelButtonColor: '#d33',
                    confirmButtonText: '确定'
                }).then((result) => {
                    if (result.value) {
                        window.location.href = "/exam/show?id="+data.examId;
                    }
                })
            }
        })
    })
</script>
</body>
</html>
